package com.hgvip.controller;

import com.hgvip.common.entity.ResponseData;
import com.hgvip.entity.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by arnold.zhu on 2017/8/1.
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping(value = "", method = RequestMethod.GET)
    public ResponseData getUserList() {
        List<User> users = new ArrayList<>();
        return new ResponseData(200, "查询成功!", users);
    }

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public ResponseData getUser(@PathVariable int id) {
        return new ResponseData(200, "查询成功!", new User(id, "zhangsan", 22, 1));
    }

}
